<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class UserIdentity extends Model
{
	use HasDateTimeFormatter;
    protected $table = 'user_identities';

    protected $fillable = [
        'avatar',
        'user_id',
        'identity',
        'firm_profession_id',
        'certificate_photos',
        'intro',
        'audit_status',
        'reject_reason',
        'record'
    ];


    protected $attributes = [
        'audit_status' => 1,
        'reject_reason' => '',
        'view_count' =>0,
        'record' => ''
    ];

    protected $casts = [
      'certificate_photos' => 'array'
    ];

    public function user()
    {
        return $this->belongsTo(User::class,'user_id');
    }
    public function category()
    {
        return $this->belongsTo(FirmProfession::class,'firm_profession_id');
    }

    public function profession()
    {
        return $this->belongsTo(FirmProfession::class,'firm_profession_id');
    }
    public function auth()
    {
        return $this->belongsTo(UserAuth::class,'user_id','user_id');
    }
}
